package com.zpark.service.Impl;

import com.zpark.mapper.IRankingMapper;
import com.zpark.pojo.Ranking;
import com.zpark.service.IRankingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RankingServiceImpl implements IRankingService {


    @Autowired
    private IRankingMapper rankingMapper;


    @Override
    public List<Ranking> findAll() {
        return rankingMapper.selectAll();
    }

    @Override
    public Integer remove(Integer id) {
        //创建实体类
        Ranking ranking = new Ranking();
        ranking.setId(id);
        return rankingMapper.delete(ranking);
    }

    @Override
    public Integer change(Ranking ranking) {
        return rankingMapper.updateByPrimaryKey(ranking);
    }

    @Override
    public Integer add(Ranking ranking) {
        return rankingMapper.insert(ranking);
    }
}
